#include"../../comm/detail.hpp"
#include"../../client/rpc_client.hpp"

using namespace std;
using namespace MuduoNet;
using namespace Message;
using namespace Dispatch;
using namespace Client;

void callback(const Json::Value &result)
{
    ILog("callback:%d",result.asInt());
}

int main()
{
    Client::RpcClient client(false,"127.0.0.1",9090);
    Json ::Value params, result;
    params["num1"] = 11;
    params["num2"] = 22;
    bool ret = client.Call("Add", params, result);
    if (ret != false)
        ILog("result: %d",result.asInt());

    Client::RpcCaller::JsonAsyncResponse res_future;
    params["num1"] = 33;
    params["num2"] = 44;
    ret = client.Call( "Add", params,res_future);
    if (ret != false)
    result=res_future.get();
        ILog("result: %d",result.asInt());
    
   
    params["num1"] = 55;
    params["num2"] = 66;
    ret = client.Call("Add", params,callback);
    DLog("....................");
    std::this_thread::sleep_for(chrono::seconds(1));
    return 0;
}